home *** CD-ROM | disk | FTP | other *** search
/ Computer Life: SuperPac / SuperPac (Computer Life Magazine)(Ziff-Davis)(1995).ISO / pc / demos / vguitar / vmmsdet.inc < prev    next >
Encoding:
Text File  |  1994-09-10  |  6.6 KB  |  199 lines

  1. '**************************************************************************
  2. '*************************  Setup Detect API's  ***************************
  3. '******* Edited by VAM of Ahead, Inc. to eliminate unused functions *******
  4. '**************************************************************************
  5.  
  6. ''detect
  7.  
  8. DECLARE FUNCTION CbGetIniKeyString LIB "msdetstf.dll" (szFile$, szSect$, szKey$, szBuf$, cbBuf%) AS INTEGER
  9. DECLARE FUNCTION WGetDOSMajorVersion LIB "msdetstf.dll" AS INTEGER
  10. DECLARE FUNCTION WGetDOSMinorVersion LIB "msdetstf.dll" AS INTEGER
  11. DECLARE FUNCTION FHasMouseInstalled LIB "msdetstf.dll" AS INTEGER
  12. DECLARE FUNCTION FDoesFileExist LIB "msdetstf.dll" (szFileName$, mode%) AS INTEGER
  13. DECLARE FUNCTION CbGetDateOfFile LIB "msdetstf.dll" (szFile$, szBuf$, cbBuf%) AS INTEGER
  14. DECLARE FUNCTION FDoesIniSectionExist LIB "msdetstf.dll" (szFile$, szSect$) AS INTEGER
  15. DECLARE FUNCTION FDoesIniKeyExist LIB "msdetstf.dll" (szFile$, szSect$, szKey$) AS INTEGER
  16. DECLARE FUNCTION FIsValidDrive LIB "msdetstf.dll" (nDrive%) AS INTEGER
  17. DECLARE FUNCTION LcbFreeDrive LIB "msdetstf.dll" (nDrive%) AS LONG
  18. DECLARE FUNCTION FDirExists LIB "msdetstf.dll" (szDir$) AS INTEGER
  19.  
  20.  
  21. '*************************************************************************
  22. '****************  Detect Basic Wrapper Declarations  ********************
  23. '*************************************************************************
  24.  
  25.  
  26. '' detect
  27.  
  28. DECLARE FUNCTION IsDriveValid (szDrive$) AS INTEGER
  29. DECLARE FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) AS STRING
  30. DECLARE FUNCTION GetDOSMajorVersion AS INTEGER
  31. DECLARE FUNCTION GetDOSMinorVersion AS INTEGER
  32. DECLARE FUNCTION GetProcessorType AS INTEGER
  33. DECLARE FUNCTION GetFreeSpaceForDrive (szDrive$) AS LONG
  34. DECLARE FUNCTION HasMouseInstalled AS INTEGER
  35. DECLARE FUNCTION DoesFileExist (szFile$, mode%) AS INTEGER
  36. DECLARE FUNCTION DoesDirExist (szDir$) AS INTEGER
  37. DECLARE FUNCTION GetDateOfFile (szFile$) AS STRING
  38. DECLARE FUNCTION DoesIniSectionExist (szFile$, szSect$) AS INTEGER
  39. DECLARE FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) AS INTEGER
  40.  
  41.  
  42. '*************************************************************************
  43. FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) STATIC  AS STRING
  44. '$ifdef DEBUG
  45.     if FValidIniFile(szFile$) = 0 then
  46.         n% = 1
  47.     elseif szKey$ = "" then
  48.         n% = 3
  49.     else
  50.         n% = 0
  51.     end if
  52.     if n% > 0 then
  53.         BadArgErr n%, "GetIniKeyString", szFile$+", "+szSect$+", "+szKey$
  54.     end if
  55. '$endif ''DEBUG
  56.  
  57.     cb% = 512
  58.     szBuf$ = STRING$(cb%, 32)
  59.     cbRet% = CbGetIniKeyString(szFile$, szSect$, szKey$, szBuf$, cb%)
  60.     GetIniKeyString = szBuf$
  61. '$ifdef DEBUG
  62.     IF cbRet% >= cb% THEN
  63.         StfApiErr saeOvfl, "GetIniKeyString", szFile$+", "+szSect$+", "+szKey$
  64.         ERROR STFERR
  65.     END IF
  66. '$endif ''DEBUG
  67.     szBuf$ = ""
  68. END FUNCTION
  69.  
  70.  
  71. '*************************************************************************
  72. FUNCTION IsDriveValid (szDrive$) STATIC  AS INTEGER
  73. '$ifdef DEBUG
  74.     if FValidDrive(szDrive$) = 0 then
  75.         BadArgErr 1, "IsDriveValid", szDrive$
  76.     end if
  77. '$endif ''DEBUG
  78.     IsDriveValid = FIsValidDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  79. END FUNCTION
  80.  
  81.  
  82. '*************************************************************************
  83. FUNCTION GetDOSMajorVersion STATIC  AS INTEGER
  84.     GetDOSMajorVersion = WGetDOSMajorVersion
  85. END FUNCTION
  86.  
  87.  
  88. '*************************************************************************
  89. FUNCTION GetDOSMinorVersion STATIC  AS INTEGER
  90.     GetDOSMinorVersion = WGetDOSMinorVersion
  91. END FUNCTION
  92.  
  93.  
  94. '*************************************************************************
  95. FUNCTION GetProcessorType STATIC  AS INTEGER
  96.     GetProcessorType = 0
  97.     longTmp& = GetWinFlags()
  98.     IF longTmp& AND WF_CPU486 THEN
  99.         GetProcessorType = 4
  100.     ELSEIF longTmp& AND WF_CPU386 THEN
  101.         GetProcessorType = 3
  102.     ELSEIF longTmp& AND WF_CPU286 THEN
  103.         GetProcessorType = 2
  104.     ELSEIF longTmp& AND WF_CPU186 THEN
  105.         GetProcessorType = 1
  106.     END IF
  107. END FUNCTION
  108.  
  109.  
  110. '*************************************************************************
  111. FUNCTION GetFreeSpaceForDrive (szDrive$) STATIC  AS LONG
  112. '$ifdef DEBUG
  113.     if FValidDrive(szDrive$) = 0 then
  114.         BadArgErr 1, "GetFreeSpaceForDrive", szDrive$
  115.     end if
  116. '$endif ''DEBUG
  117.     GetFreeSpaceForDrive = LcbFreeDrive(ASC(UCASE$(szDrive$)) - ASC("A") + 1)
  118. END FUNCTION
  119.  
  120.  
  121. '*************************************************************************
  122. FUNCTION HasMouseInstalled STATIC  AS INTEGER
  123.     HasMouseInstalled = FHasMouseInstalled
  124. END FUNCTION
  125.  
  126.  
  127. '*************************************************************************
  128. FUNCTION DoesFileExist (szFileName$, mode%) STATIC  AS INTEGER
  129. '$ifdef DEBUG
  130.     if FValidFATPath(szFileName$) = 0 then
  131.         BadArgErr 1, "DoesFileExist", szFileName$+", "+STR$(mode%)
  132.     end if
  133. '$endif ''DEBUG
  134.     DoesFileExist = FDoesFileExist(szFileName$, mode%)
  135. END FUNCTION
  136.  
  137.  
  138. '*************************************************************************
  139. FUNCTION DoesDirExist (szDir$) STATIC  AS INTEGER
  140. '$ifdef DEBUG
  141.     if FValidFATDir(szDir$) = 0 then
  142.         BadArgErr 1, "DoesDirExist", szDir$
  143.     end if
  144. '$endif ''DEBUG
  145.     DoesDirExist = FDirExists(szDir$)
  146. END FUNCTION
  147.  
  148.  
  149. '*************************************************************************
  150. FUNCTION GetDateOfFile (szFile$) STATIC  AS STRING
  151. '$ifdef DEBUG
  152.     if FValidFATPath(szFile$) = 0 then
  153.         BadArgErr 1, "GetDateOfFile", szFile$
  154.     end if
  155. '$endif ''DEBUG
  156.     cb% = 20
  157.     szBuf$ = STRING$(cb%, 32)
  158.     cbRet% = CbGetDateOfFile(szFile$, szBuf$, cb%)
  159.     GetDateOfFile = szBuf$
  160. '$ifdef DEBUG
  161.     IF cbRet% >= cb% THEN
  162.         StfApiErr saeOvfl, "GetDateOfFile", szFile$
  163.         ERROR STFERR
  164.     END IF
  165. '$endif ''DEBUG
  166.     szBuf$ = ""
  167. END FUNCTION
  168.  
  169.  
  170. '*************************************************************************
  171. FUNCTION DoesIniSectionExist (szFile$, szSect$) STATIC  AS INTEGER
  172. '$ifdef DEBUG
  173.     if FValidIniFile(szFile$) = 0 then
  174.         BadArgErr 1, "DoesIniSectionExist", szFile$+", "+szSect$
  175.     end if
  176. '$endif ''DEBUG
  177.     DoesIniSectionExist = FDoesIniSectionExist(szFile$, szSect$)
  178. END FUNCTION
  179.  
  180.  
  181. '*************************************************************************
  182. FUNCTION DoesIniKeyExist (szFile$, szSect$, szKey$) STATIC  AS INTEGER
  183. '$ifdef DEBUG
  184.     if FValidIniFile(szFile$) = 0 then
  185.         n% = 1
  186.     elseif szKey$ = "" then
  187.         n% = 3
  188.     else
  189.         n% = 0
  190.     end if
  191.     if n% > 0 then
  192.         BadArgErr n%, "DoesIniKeyExist", szFile$+", "+szSect$+", "+szKey$
  193.     end if
  194. '$endif ''DEBUG
  195.  
  196.     DoesIniKeyExist = FDoesIniKeyExist(szFile$, szSect$, szKey$)
  197. END FUNCTION
  198.  
  199.